import time
import random

#####################################################
#
# simple python script for generating random expenses
#
#####################################################

# ids of vehicles, range
vehicle_ids = range(1,11)
# number of expenses generated for each vehicle
expenses_count = 8
# gas price, base, will be randomized
base_gas_price = 33
# gas amount, base, will be randomized
gas_amount = 40
# mileage, base, will be randomized
mileage_start = 50000
# id of user
user_id = 1

for i in vehicle_ids:
    mileage = mileage_start + random.randint(-20000, 100000)
    for j in range(0,expenses_count):
        mileage = mileage + random.randint(300, 500)
        real_gas_count = base_gas_price + random.randint(-5, 5)
        real_gas_price = (base_gas_price + random.randint(-2, 2)) * real_gas_count
        print "INSERT INTO expense (expenseType,expenseDate,mileage,quantity,price,personId,vehicleId) VALUES('GAS'," + str(int(time.time())) + "," + str(mileage) + "," + str(real_gas_count) + "," + str(real_gas_price) + "," + str(user_id) + "," + str(i) + ");"
        if( (j % 2) == 0):
            print "INSERT INTO expense (expenseType,expenseDate,mileage,quantity,price,personId,vehicleId) VALUES('REPAIR'," + str(int(time.time())) + "," + str(mileage + random.randint(10,50)) + "," + str(1) + "," + str(random.randint(500, 10000)) + "," + str(user_id) + "," + str(i) + ");"
